gsk/ngl/fp16.c: Implement runtime F16C detection on MSVC
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 12 Apr 2021 08:48:15 +0000 (16:48 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 12 Apr 2021 10:13:42 +0000 (18:13 +0800)
commitd5ced21264ecf75df01ca11e86d240283cb82276
tree8de24d3d15bc044d44df9d6706d903d7257864e2
parent6d6c8c59ebbcab0a2ec3e87912f4daf466da1e54
gsk/ngl/fp16.c: Implement runtime F16C detection on MSVC

We need to use __cpuid() to check for the presence of F16C instructions on
Visual Studio builds, and call the half_to_float4() or float_to_half4()
implementation accordingly, as the __builtin_cpu...() functions are strictly
for GCC or CLang only.

Also, since __m128i_u is not a standard intrisics type across the board, just
use __m128i on Visual Studio as it is safe to do so there for use for
_mm_loadl_epi64().

Like running on Darwin, we cannot use the alias __attribute__ as __attribute__
is also for GCC and CLang only.
gsk/ngl/fp16.c